Web based moderation system for MLMMJ
Hi,
I have somebody that uses our open source control panel (DTC) that has complained that there is no moderation interface using web (and not using the reply thing on a moderation message). He needs it for a big number of high traffic lists.
So here is my question: is there a way to do such web-based moderation with MLMMJ? If yes how? If no, how could I write/contribute it?
Thomas
Quoted 4 lines · Thomas Goirand
I have somebody that uses our open source control panel (DTC) that has complained that there is no moderation interface using web (and not using the reply thing on a moderation message). He needs it for a big number of high traffic lists.
It cannot at the moment, but if I know you, you'll have it able to very soon ;-)
Quoted 2 lines
So here is my question: is there a way to do such web-based moderation with MLMMJ? If yes how? If no, how could I write/contribute it?
Thinking really quickly about it, here's the route I would have a look at:
i) tunable 'cmdlinemoderation' which makes mlmmj not send mails, but just leave it in the directory. Maybe even put a path to a directory in the moderation file where mlmmj then would put the same files as it would in LISTDIR/moderation. That could be the directory where your web code would look and reflect upon
ii) when someone in the web moderation page clicks to moderate a mail
you would invoke the same code path from the commandline (see listcontrol.c) as when a mail arrives accepting a moderation. You might do this by just sending a mail to listname+moderate-KEY or what the precise address should be.
Comments from Morten, etc. wrt. security would of course be welcome :)
Signature · 4 lines
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.Quoted 14 lines · Mads Martin Joergensen
Thinking really quickly about it, here's the route I would have a look at:
i) tunable 'cmdlinemoderation' which makes mlmmj not send mails, but just leave it in the directory. Maybe even put a path to a directory in the moderation file where mlmmj then would put the same files as it would in LISTDIR/moderation. That could be the directory where your web code would look and reflect upon
ii) when someone in the web moderation page clicks to moderate a mail
you would invoke the same code path from the commandline (seelistcontrol.c) as when a mail arrives accepting a moderation. You might do this by just sending a mail to listname+moderate-KEY or what the precise address should be.
Quoted 1 line
Comments from Morten, etc. wrt. security would of course be welcome :)
I have read a bit listcontrol.c, and the way I understand it, is that the web interface should:
- rename moderated with:
mv hash hash.sending
- call the following:
mlmmjsend -L listdir -m hash.sending
Just one thing: what is in execlp() that is not in the system exec() function?
If it's THAT simple, then I guess I can write a very tiny (single file) php script to do that job... Of course, php should have enough access right to be able to read/write in the list dir, but I guess this is more an administrator's job than mine in this case.
The only real issue that I can forecast here, is how to display nicely the list of message to be moderated. I guess it would be best to use something that already exists. Maybe there's a lib to do that in PEAR? Anybody has an idea how to do this with not too much programming work?
Thomas
Quoted 2 lines · Thomas Goirand
Just one thing: what is in
execlp()that is not in the systemexec()function?
Have a look at exec(3):
DESCRIPTION
The exec() family of functions replaces the current process image with a new process image. The functions described in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further details about the replacement of the current process image.)
There actually exist no exec() call. You might be thinking of system()?
Signature · 4 lines
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.Quoted 6 lines · Mads Martin Joergensen
Quoted 2 lines · Thomas Goirand
Just one thing: what is in
execlp()that is not in the systemexec()function?Have a look at exec(3):
Quoted 8 lines
DESCRIPTION
Theexec()family of functions replaces the current process image with a new process image. The functions described in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further details about the replacement of the current process image.)There actually exist no
exec()call. You might be thinking ofsystem()?
Forget it, I thought execlp() was internal to MLMMJ, but I have found my answer, it's documented.
Anyway, my question remains... Is the procedure like this:
- rename moderated with:
mv hash hash.sending
- call the following:
mlmmjsend -L listdir -m hash.sending
Also, pops to my mind: why should I rename the moderated message? Is it mandatory? Should the moderation web interface delete the moderated message with unlink after the call to mlmmjsend?
Thomas
Quoted 4 lines · Thomas Goirand
Anyway, my question remains... Is the procedure like this:
- rename moderated with:
mv hash hash.sending
That mv is done by mlmmj-send while sending, you should never have to do that.
I would suggest you send a mail to a moderated list, go to the LISTDIR and see what it looks like while it's waiting for the moderator to reply.
You need exectly the same, but just not send a mail to moderators, but leave the moderation action for the webinterface...
Quoted 6 lines
- call the following:
mlmmjsend -L listdir -m hash.sendingAlso, pops to my mind: why should I rename the moderated message? Is it mandatory? Should the moderation web interface delete the moderated message with unlink after the call to mlmmjsend?
... and when the webinterface clicks moderate you do the same as if the moderator replied to the mail. Just send a mail to the reply-to address from your webserver. You know how to construct the correct reply-to when you have access to the moderation/ directory.
And if you send the mail, then you don't have to do anything else, since that's not needed with mail moderation either.
Signature · 4 lines
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.Quoted 7 lines · Mads Martin Joergensen
... and when the webinterface clicks moderate you do the same as if the moderator replied to the mail. Just send a mail to the reply-to address from your webserver. You know how to construct the correct reply-to when you have access to the moderation/ directory.
And if you send the mail, then you don't have to do anything else, since that's not needed with mail moderation either.
I would recommend this approach too. From an administration point of view, the only thing neccesary would then be for the web server user to have read access to the moderation directory.
Signature · 1 line
Christian Laursen
Quoted 7 lines · Christian Laursen
Quoted 5 lines · Mads Martin Joergensen
... and when the webinterface clicks moderate you do the same as if the moderator replied to the mail. Just send a mail to the reply-to address from your webserver. You know how to construct the correct reply-to when you have access to the moderation/ directory.
Quoted 6 lines
Quoted 2 lines
And if you send the mail, then you don't have to do anything else, since that's not needed with mail moderation either.
I would recommend this approach too. From an administration point of view, the only thing neccesary would then be for the web server user to have read access to the moderation directory.
There we go! I spent my Sunday afternoon on it, and the result is attached.
Here are some explanations.
* dependencies *
This app needs:
- php with gettext() support (for translations). Nearly all (if not all) Unix distributions have php with gettext support.
- The Mail_mime PEAR package (php-mail-mime in Debian)
* setup *
- Unpack the tar.gz
- Run "make i18n" to generate the gettext binaries out of the sources
- Edit the 5 variables on top of mlmmj-moderation.php to set the moderation folder, list name, domain, delimiter and the address used to send the moderation validation messages. You will need gettext installed on your system...
- Eventually rename mlmmj-moderation.php and edit mlmmj.css to your taste
- Add a .htaccess / .htpasswd to protect the moderation folder from others
- make it so this app have read/write access to the moderation folder. Write access is needed because the app does some unlink() calls to delete the messages.
- If using debian, you might need to dpkg-reconfigure locales and add fr_FR.UTF-8, if you want to see my French translation (there might be some other distributions needing the same kind of thing, I don't know...).
* known issues *
- Because this web app is sending an email to validate messages to be moderated, once you have hit "validate", validated messages will still (most of the times) show in the interface, as the folder is (most of the times) read before MLMMJ has time to send the moderated messages and remove them from the moderation folder.
A workaround would be to NOT display messages that are moderated on the URL bar, but it's not a good way to go, as if the server is very busy, the next refresh of the page (the one after the validation) can still show some messages already validated. We see here that the method to send emails doesn't seem to be very good... Would it be possible for me to rename the moderated messages???
- Because it's the first version, I have not yet used POST, but some GET in order to see things on the URL bar. So, of course, we are here hitting the limitation of the URL size (if there are really a lot of messages to moderate). This can be changed later simply by adding method="POST" in the form, as I use $_REQUEST (and not the stupid $_POST / $_GET that everybody uses...). I might do this on the next version, but for now, it's more easy for debug purposes to keep it this way.
I hope you guys will like my work. Comments and critics are welcome, I'd be happy to add some improvements.
Regards,
Thomas Goirand
P.S: A nice name for this app would be cool. Ideas?
Is anybody interested in my work here? Or nobody cares?
Thomas
Thomas,
Thanks for the work, and I apologise for being slow to respond.
I am interested, and intend to install and use the web interface. However, I use MLMMJ for only a few low volume lists, so this is not one of my high priority tasks right at present.
James
Quoted 10 lines
-----Original Message-----
From: Thomas Goirand [mailto:[email protected]]
Sent: Sunday, 1 March 2009 7:55 p.m.
To: [email protected]
Subject: Re: Web based moderation system for MLMMJIs anybody interested in my work here? Or nobody cares?
Thomas
Quoted 9 lines · James Scott
Thomas,
Thanks for the work, and I apologise for being slow to respond.
I am interested, and intend to install and use the web interface. However, I use MLMMJ for only a few low volume lists, so this is not one of my high priority tasks right at present.
James
Hi!
As I wrote to Martin, I don't really care that one too, I was just annoyed that a user of our open source web hosting control panel complained that MLMMJ didn't have the feature while Sympa did. So I thought it would be a nice addition, and a quite mandatory feature for busy moderated lists. I just hope this will help promoting my favorite mailing list software! :)
Thomas
P.S: FYI, our panel (DTC) is now in Debian Lenny. I guess this makes it the only full solution for managing MLMMJ (and of course other stuffs) in Debian.
Hi Thomas,
First of all: Sorry about the long response time.
Quoted 6 lines · Thomas Goirand
As I wrote to Martin, I don't really care that one too, I was just annoyed that a user of our open source web hosting control panel complained that MLMMJ didn't have the feature while Sympa did. So I thought it would be a nice addition, and a quite mandatory feature for busy moderated lists. I just hope this will help promoting my favorite mailing list software! :)
Thanks for the code - I've committed it to CVS, and it will be included in the next release of mlmmj :)
For the impatient souls out there, it can also be downloaded from
http://mlmmj.mmj.dk/~mortenp/mlmmj-php-moderation-cvs20090304.tar.bz2
There is a few notices. Could you take care of them? It's not urgent.
Notice: Use of undefined constant show_message - assumed 'show_message' in /home/mopo/mlmmj/contrib/web/php-moderation/mlmmj-moderation.php on line 237
These can only be provoked by a malformed mail, but it would be nice to get rid of them anyway:
Notice: Undefined index: date in /home/mopo/mlmmj/contrib/web/php-moderation/mlmmj-moderation.php on line 154
Notice: Undefined index: subject
in /home/mopo/mlmmj/contrib/web/php-moderation/mlmmj-moderation.php on line 155
Notice: Undefined index: from
in /home/mopo/mlmmj/contrib/web/php-moderation/mlmmj-moderation.php on line 161
Best regards,
Morten
Signature · 3 lines
Morten K. Poulsen <[email protected]> CTO, FableTech http://fabletech.com/
Quoted 2 lines · Morten K. Poulsen
Thanks for the code - I've committed it to CVS, and it will be included in the next release of mlmmj :)
I totally forgot to mention that I've edited the Makefile a bit (and renamed it to build-translations.sh). It didn't have any dependency handling anyway ;)
Morten
Signature · 3 lines
Morten K. Poulsen <[email protected]> CTO, FableTech http://fabletech.com/
Quoted 2 lines · Morten K. Poulsen
Thanks for the code - I've committed it to CVS, and it will be included in the next release of mlmmj :)
Cheers!
Quoted 4 lines
For the impatient souls out there, it can also be downloaded from
http://mlmmj.mmj.dk/~mortenp/mlmmj-php-moderation-cvs20090304.tar.bz2There is a few notices. Could you take care of them? It's not urgent.
Outch! I normally work with error reporting E_ALL, my bad...
By the way, I did it right away, because otherwise I will forget.
Quoted 2 lines
These can only be provoked by a malformed mail, but it would be nice to get rid of them anyway:
I didn't even think a mail could ever be sent with no From:, Date: or such header. How nasty can it be that a mail server is accepting such email? :(
Attached is a diff to apply. It seems you missed my README, can you re-add it in the folder? The notes are quite important for the setup, especially the things about the .htaccess. Also, why the .htaccess in the translation folder has been renamed to dot.htaccess? Is that because you are using CVS? To me, it would be wise to switch to Git. You would never regret it!!!
Thomas
contrib/web/php-moderation/mlmmj-moderation.php +14 -4
@@ -151,14 +151,24 @@ } $out .= "<tr>"; $out .= "<td $cls>" . "<input type=\"checkbox\" name=\"msg_id[]\" value=\"". $all_msg[$i]["filename"] ."\">" . "</td>"; - $out .= "<td $cls>" . htmlspecialchars($all_msg[$i]["headers"]["date"]) . "</td>"; - if( strlen($all_msg[$i]["headers"]["subject"]) == 0){ + if( isset($all_msg[$i]["headers"]["date"]) ){ + $mydate = htmlspecialchars($all_msg[$i]["headers"]["date"]); + }else{ + $mydate = _("No date"); + } + $out .= "<td $cls>" . $mydate . "</td>"; + if( !isset($all_msg[$i]["headers"]["subject"]) || strlen($all_msg[$i]["headers"]["subject"]) == 0){ $subject = _("No subject"); }else{ $subject = $all_msg[$i]["headers"]["subject"]; } $out .= "<td $cls><a href=\"". $_SERVER["PHP_SELF"] ."?action=show_message&msgid=". $all_msg[$i]["filename"] ."\">" . htmlspecialchars($subject) . "</a></td>"; - $out .= "<td $cls>" . htmlspecialchars($all_msg[$i]["headers"]["from"]) . "</td>"; + if( isset($all_msg[$i]["headers"]["from"]) ){ + $myfrom = htmlspecialchars($all_msg[$i]["headers"]["from"]); + }else{ + $myfrom = _("No from in headers"); + } + $out .= "<td $cls>" . $myfrom . "</td>"; $out .= "</tr>\n"; } $out .= "</table>\n";
@@ -234,7 +244,7 @@ <h3>MLMMJ "._("moderation web interface")."</h3> <a href=\"".$_SERVER["PHP_SELF"]."\">"._("Refresh page")."</a>"; -if( isset($_REQUEST["action"]) && $_REQUEST["action"] == show_message){ +if( isset($_REQUEST["action"]) && $_REQUEST["action"] == "show_message"){ if( !ereg("^([0-9a-f]+)\$",$_REQUEST["msgid"]) ){ echo "<span class=\"errorMessages\">"._("Message ID format is wrong: can't display!")."</span>"; }else{
contrib/web/php-moderation/translations/fr_FR.po +31 -22
122 lines not on this page · raw message
Only in mlmmj/contrib/web/php-moderation/translations: templates.pot
Hi Thomas,
Quoted 3 lines · Thomas Goirand
Outch! I normally work with error reporting
E_ALL, my bad...By the way, I did it right away, because otherwise I will forget.
That one was for me, right? ;-)
Quoted 3 lines
I didn't even think a mail could ever be sent with no From:, Date: or such header. How nasty can it be that a mail server is accepting such email? :(
I am not sure that it will ever happen in real life, but I had the path set to the listdir (not listdir/moderation) by error, so that's why it barfed.
Quoted 1 line
Attached is a diff to apply.
Thanks, I have committed it to CVS.
Quoted 1 line
It seems you missed my README, can you re-add it in the folder?
I don't think it was the tarball, so I have copied the text from the mail body of your original mail into a README file, and committed it to CVS. Please check it to see if is what you wanted.
The updated version is available here:
http://mlmmj.mmj.dk/~mortenp/mlmmj-php-moderation-cvs20090306.tar.bz2
Quoted 2 lines
Also, why the .htaccess in the translation folder has been renamed to dot.htaccess? Is that because you are using CVS?
No, it's because I don't like to have "hidden" files in the distribution. It's an old BOFH habit.
Quoted 2 lines
To me, it would be wise to switch to Git. You would never regret it!!!
Git is just the RCS flavor of the month. I don't see any compelling arguments in favor of switching. Subversion might be an alternative to CVS, but what do we gain by switching away from a tried and tested revision control system which does a perfect job of keeping track of the source code?
//mopo
Signature · 3 lines
Morten K. Poulsen <[email protected]> CTO, FableTech http://fabletech.com/
Quoted 5 lines · Morten K. Poulsen
Quoted 1 line
It seems you missed my README, can you re-add it in the folder?
I don't think it was the tarball, so I have copied the text from the mail body of your original mail into a README file, and committed it to CVS. Please check it to see if is what you wanted.
Perfect then. That was more or less the same stuff.
Quoted 5 lines
Quoted 2 lines
Also, why the .htaccess in the translation folder has been renamed to dot.htaccess? Is that because you are using CVS?
No, it's because I don't like to have "hidden" files in the distribution. It's an old BOFH habit.
It's ok then, but does your Makefile renames it?
Thomas
Hi Thomas,
Quoted 5 lines · Thomas Goirand
Quoted 3 lines
I don't think it was the tarball, so I have copied the text from the mail body of your original mail into a README file, and committed it to CVS. Please check it to see if is what you wanted.
Perfect then. That was more or less the same stuff.
Cool. Let me know if you have any changes or additions.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Also, why the .htaccess in the translation folder has been renamed to dot.htaccess? Is that because you are using CVS?
No, it's because I don't like to have "hidden" files in the distribution. It's an old BOFH habit.
It's ok then, but does your
Makefilerenames it?
No, there is no Makefile any longer (and it would IMO be just as bad as distributing the file directly). But I added a word about it in the README, just like there is for web/php-admin and web/perl-admin. I hope that's good enough. I haven't heard about any confusion from anybody about the other interfaces.
Morten
Signature · 3 lines
Morten K. Poulsen <[email protected]> CTO, FableTech http://fabletech.com/